<template>
    <div class="msg" @click="handleClick">{{msg}}</div>
</template>

<script lang="ts">
    import Vue from "vue";

    export default Vue.extend({
        data() {
            return {
                msg: 'hello Vue'
            }
        },
        methods: {
            async handleClick() {
                const data = await this.sum(1, 2);
                console.log(data);
            },
            sum(a: number, b: number) {
                return new Promise(resolve => {
                    setTimeout(() => {
                        resolve(a + b);
                    })
                })
            }
        }
    })
</script>

<style scoped>
    .msg {
        color: red;
    }
</style>
